SWAGOLX.EXE (c) 1993 GDSOFT ALL RIGHTS RESERVED 00004 1 08-24-9413:17ALL IAN LIN 80x50 text mode SWAG9408 òây■ 3 ▐« AS> Could someone tell me how to access 80x50 text mode inπ AS> Tp 6.0 = mode con lines=50 in dos.ππUses Crt;πbeginπ textmode(c80+font8x8); {80x50}π textmode(c80); {80x25}πend.π 2 08-24-9413:25ALL ERIK ANDERSON BIOS Control SWAG9408 £ H┤ 18 ▐« {πML>Basically a function that allows me to have 3 lines at the top non scrollablπML>(that I can change, the content of the lines), but so the stuff underthemπML>scrolles...ππWell, when you don't like the way the BIOS scrolls the screen, changeπthe BIOS!ππHere's an interesting program that I just wrote for this purpose. Itπinstalls a TSR-like program that interferes with the BIOS scroll-upπroutine and forces the top to be a variable you set.ππWhile debugging the program, I ran into a bit of trouble with the wayπthat TP handles interrupts. If you notice, half of the ISR has turnedπinto restoring the registers that TP trashes!π========================================================================π}πUses Dos, Crt; {Crt only used by main pgm}ππvarπ TopLine : byte;π V : STRING;π OldInt : Procedure;ππ{Procedure Catch is the actual ISR, filtering out BIOS SCROLL-UP commands, andπ forcing the top of the scroll to be the value [TopLine] }ππ{$F+}πprocedure Catch(Flags, rCS, rIP, rAX, rBX, rCX, rDX, rSI, rDI, rDS, rES, rBP: WORD); INTERRUPT;π{ Procedure Catch; interrupt;}π begin {Catch}π asmπ MOV AX, Flagsπ SAHFπ MOV AX, rAXπ MOV BX, rBXπ MOV CX, rCXπ MOV DX, rDXπ MOV SI, rSIπ MOV DI, rDIπ CMP AH, 06π JNE @Passπ CMP CH, TopLineπ JA @Passπ MOV CH, TopLineππ@Pass:π end;π OldInt; {Pass through to old handler}π asmπ MOV rAX, AXπ MOV rBX, BXπ MOV rCX, CXπ MOV rDX, DXπ MOV rSI, SIπ MOV rDI, DIπ end;π end; {Catch}π{$F-}ππ Procedure Install;π beginπ GetIntVec($10, Addr(OldInt));π SetIntVec($10, Addr(Catch));π end;ππ Procedure DeInstall;π beginπ SetIntVec($10, Addr(OldInt));π end;ππ FUNCTION ItisTrue : BOOLEAN;π BEGINπ ItisTrue := (V <> 'quit');π END;ππbeginπ ClrScr;π DirectVideo := TRUE;π TopLine := 5; {Keep 5+1 lines at top of screen}π Install;π GoToXY(1,24);π WriteLn('Start Typing to see demo... type "quit" to stop ..');π while Itistrue do readln(V);π DeInstall;πend.π====================================================================π 3 08-24-9413:40ALL MARCIN BORKOWSKI FAST GoToXY (BASM) SWAG9408 ^{.╧ 3 ▐« πprocedure GoToXY(x,y : word);πbeginπ asmπ mov ax,yπ mov dh,alπ dec dhπ mov ax,xπ mov dl,alπ dec dlπ mov ah,2π xor bh,bhπ int 10hπ endπend;ππ 4 08-26-9408:32ALL P. MACKAY ANSI/BIOS/DIRECT Writes SWAG9408 Lú8√ 59 ▐« πUnit IO;πππ{ Copyright (C) 1988 by P.Mackay. All Rights Reservedππ Name : IOππ Compiler : Unit for Borland's Turbo-Pascal v4/5 ...ππ Function : Provides capability to easily use and switch between the 3π output methods available: ANSI/BIOS/DIRECT-WRITES.ππ Guarantee: If it breaks, you get to keep both pieces.ππ Author : Phil Mackay,π 21 Andrew Place, North Rocksπ 2151 N.S.W Australia. }ππinterfaceππTypeπ OutType = (ANSI,BIOS,DIRECT);ππConstπ CLS = #27 + '[2J';π Left = #27 + '[1D';π Right = #27 + '[1C';π Up = #27 + '[1A';π Down = #27 + '[1B';π Black = #27 + '[30m';π Blue = #27 + '[34m';π Green = #27 + '[32m';π Cyan = #27 + '[36m';π Orange = #27 + '[31m';π Purple = #27 + '[35m';π Red = #27 + '[33m';π White = #27 + '[37m';π BlackB = #27 + '[40m';π BlueB = #27 + '[44m';π GreenB = #27 + '[42m';π CyanB = #27 + '[46m';π OrangeB = #27 + '[41m';π PinkB = #27 + '[45m';π RedB = #27 + '[43m';π WhiteB = #27 + '[47m';π Bold = #27 + '[1m';π Flash = #27 + '[5m';π Off = #27 + '[0m';ππvarπ IOmethod : OutType;π backcolor : integer;πprocedure IOGotoXY(x,y : integer);πprocedure IOTextColor(color : integer);πprocedure IOTextBackground(color : integer);πprocedure IOClrEol;πprocedure IOClrScr;πprocedure OutputMethod (Method : OutType);ππimplementationππUses CRT;ππprocedure IOGotoXY(x,y : integer);πvarπ Sx,Sy : string;πbeginπ if IOmethod = ANSI thenπ beginπ Str(x,Sx);π str(y,Sy);π write(#27 + '[' + Sy + ';' + Sx + 'H');π endπ else GotoXY(x,y);πend;πππprocedure IOTextColor(color : integer);ππvarπ flashing : boolean;ππbeginπ if IOmethod = ANSI thenπ beginπ flashing := false;ππ if color > 15 thenπ beginπ color := color - 16;π flashing := true;π endπ elseπ write (off);ππ if color > 7 thenπ beginπ color := color - 8;π write (Bold);π endπ elseπ write (off);ππ if flashing then write (flash);ππ case color ofπ 0 : write (#27 + '[30m');π 1 : write (#27 + '[34m');π 2 : write (#27 + '[32m');π 3 : write (#27 + '[36m');π 4 : write (#27 + '[31m');π 5 : write (#27 + '[35m');π 6 : write (#27 + '[33m');π 7 : write (#27 + '[37m');π end;π IOTextBackground(Backcolor);π endπ else TextColor(color);πend;πππprocedure IOTextBackground(color : integer);πbeginπ if IOmethod = ANSI thenπ beginπ Case color ofπ 0 : write (#27 + '[40m');π 1 : write (#27 + '[44m');π 2 : write (#27 + '[42m');π 3 : write (#27 + '[46m');π 4 : write (#27 + '[41m');π 5 : write (#27 + '[45m');π 6 : write (#27 + '[43m');π 7 : write (#27 + '[47m');π end;π BackColor := color;π endπ else TextBackground(color);πend;πππprocedure IOClrEol;πbeginπ if IOmethod = ANSI then write (#27 + '[K')π else ClrEol;πend;πππprocedure IOClrScr;πbeginπ if IOmethod = ANSI then write (Cls)π else clrscr;πend;πππprocedure OutputMethod (Method: OutType);ππbeginπ Case Method ofπ ANSI : beginπ assign (input,'');π reset (input);π assign (output,'');π rewrite (output);π IOmethod := ANSI;π end;π BIOS : beginπ AssignCRT (output);π rewrite (output);π AssignCRT (input);π reset (input);π DirectVideo := false;π IOmethod := BIOS;π end;π DIRECT : beginπ AssignCRT (output);π rewrite (output);π AssignCRT (input);π reset (input);π DirectVideo := true;π IOmethod := DIRECT;π end;π end;πend;ππbeginπ OutputMethod(ANSI);πEnd.ππ{-------------------------- DEMO ------------------------ }ππProgram IOtester;ππUses Crt, {only for the Keypressed function}π IO; { <=== This is it }ππ(* This demo will demonstrate the pros and cons of the video addressingπ types. The only thing non-standard about it, is that this programπ uses KeyPressed to detect the "press any key .." which bypasses theπ Standard IO, and uses a BIOS keyboard routine. *)ππ(* IO and IODEMO are written by P.Mackay. *)π(* Copyright (C) 1988 All Rights Reserved *)ππprocedure Routine;ππvarπ i : integer;π ch: char;πππbeginπ IOClrScr;π IOTextcolor(7);π writeln ('TEST; I/O testing program');π IOgotoxy(6,4);π IOtextcolor(2);π writeln ('This program will demostrate the capabilities of the IO unit.');π if IOmethod = ANSI thenπ beginπ IOgotoxy(14,8);π IOtextcolor(14);π writeln ('Current operation: ANSI (standard-output)');π IOgotoxy(1,10);π IOtextcolor(3);π writeln (' ANSI output uses a special sequence of control codes to send information');π writeln ('on things such as colour, cursor position etc .. A ANSI driver, however');π writeln ('is required to see these. ANSI is slow, but very useful for re-direction');π writeln ('in that it can be sent to a remote over a modem connection.');π end;π If IOmethod = BIOS thenπ beginπ IOgotoxy(14,8);π IOtextcolor(14);π writeln ('Current operation: BIOS');π IOgotoxy(1,10);π IOtextcolor(3);π writeln (' BIOS output is many times slower than DIRECT, but it is useful in multi-');π writeln ('tasking environments, where a program can re-route the BIOS video calls.');π writeln ('Programs which have bulk output would not use BIOS, but BIOS is good for');π writeln ('static output.');π end;π if IOmethod = DIRECT thenπ beginπ IOgotoxy(14,8);π IOtextcolor(14);π writeln ('Current operation: DIRECT');π IOgotoxy(1,10);π IOtextcolor(3);π writeln (' DIRECT output is where a program directly writes to the memory on the');π writeln ('display adapter. The only problems with this, is it sometimes causes snow');π writeln ('and may not work on some flavours of MS-DOS. Direct-writes are used by');π writeln ('most applications today, as it is so incredibly fast.');π writeln (' It is so fast, infact, you may not be able to see the line below becuase');π writeln ('it is being updated so frequently. (depends on computer type)');π end;ππ IOgotoxy(15,16);π IOtextcolor(15);π write ('Speed test: (press any key)');ππ i := 0;π repeatπ IOgotoxy(5,20);π write ('This is being written, wiped and re-written: ',i);π IOgotoxy(5,20);π write (' ');π i := i + 1;π until keypressed;ππ ch := readkey;πend;ππbeginπ CheckSnow := False;ππ OutputMethod(ANSI);π Write (BlackB); (* Black background ANSI code *)π Routine;ππ OutputMethod(BIOS);π Routine;ππ OutputMethod(DIRECT);π Routine;ππ OutputMethod(ANSI);π IOClrscr;π IOTextcolor(15);π IOTextbackground(1);π Write ('IO; ANSI/BIOS/DIRECT routines for Turbo-Pascal v4 & 5 DEMO by P.Mackay');π IOClrEol;π IOTextbackground(0);π IOTextcolor(7);π writeln;π writeln;πend.π